import { http } from '@/apis/http';
import type { ApiResponse, ApiResponsePage } from '@/apis/types/Response';
import type { CommentView } from '@/apis/types/Comment';

export const commentApi = {
    /**
     * 获取评论列表
     */
    getList(articleId: number, pageNum: number, pageSize: number) {
        return http.get<ApiResponsePage<CommentView[]>>(`/content/comment/getList`, { params: { articleId, pageNum, pageSize } });
    },
    /**
     * 添加评论
     */
    addComment(comment: Comment) {
        return http.post<ApiResponse<null>>(`/content/comment/add`, comment);
    },
    /**
     * 更新评论
     */
    updateComment(comment: Comment) {
        return http.post<ApiResponse<null>>(`/content/comment/update`, comment);
    },
    /**
     * 删除评论
     */
    deleteComment(id: number) {
        return http.post<ApiResponse<null>>(`/content/comment/delete/${id}`);
    },
}
